{__NOLAYOUT__}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <link href="__STATIC__/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <script src="__STATIC__/jquery-3.3.1.min.js"></script>
    <script src="__STATIC__/bootstrap/js/bootstrap.min.js"></script>
    <link href="__STATIC__/style.css" rel="stylesheet">
    <script src="__STATIC__/layer/layer.js"></script>
    <script src="__STATIC__/js/common.js"></script>
</head>
<style>
    body{
        background-color: #ddd;
        height: 100%;
    }
    .login-div{
        background-color: white;
        border-radius: 4px;
        padding: 50px;
    }
</style>
<body>
<div class="container" onkeypress="onKeyPress(event)">
    <div class="row">
        <div class="col-sm-offset-3 col-sm-6" style="margin-top: 200px;">
            <div class="login-div">
                <div class="form-group">
                    <label>工号</label>
                    <input type="text" id="userId" name="user_id" class="form-control">
                </div>
                <div class="form-group">
                    <label>密码</label>
                    <input type="password" id="password" name="password" class="form-control">
                </div>
                <div >
                    <button class="btn btn-info btn-block" onclick="clickLogin()">登录</button>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    
    function onKeyPress(e) {
        var keyCode = null;

        if(e.which)
            keyCode = e.which;
        else if(e.keyCode)
            keyCode = e.keyCode;

        if(keyCode == 13)
        {
            clickLogin();
            return false;
        }
        return true;
    }
    
    function clickLogin() {
        var userId = $("#userId").val();
        var password = $("#password").val();
        if(userId == ''){
            layer.alert('请输入工号',{icon:2});
            return;
        }
        if(password == ''){
            layer.alert('请输入密码',{icon:2});
            return;
        }

        ajax("{:url('login2')}",{userId:userId,password:password},function (data) {
            location.href = "{:url('index/index/index')}";
        });
    }
</script>
</html>